import React ,{ useState }  from 'react'

export default function (props) {
    const [type,setType] = useState('')
    const [content,setContent] = useState('')
    const search = () => {
        props.toSearch(type,content)
        setContent('')
    }
    const selectedVal = (e) => {
        setType(e.target.value)
    }
    const inputVal = (e) => {
        setContent(e.target.value)
    }
    return (
        <div>
            <p>
                <select name="searchType" id="" onBlur={selectedVal}>
                    <option value="name" >姓名</option>
                    <option value="gender">性别</option>
                    <option value="age">年龄</option>
                </select>
                <input  type="text" value={content} onChange={inputVal}/>
                <button  style={{width:'100px'}} onClick={search}>搜索</button>
            </p>
        </div>
    )
}
